<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

// 设置首页路由
Route::get('/', 'IndexController/index');
Route::get('about', 'IndexController/about');
Route::get('features', 'IndexController/features');
Route::get('contact', 'IndexController/contact');

// 用户相关路由
Route::post('user/register', 'UserController/register');
Route::post('user/login', 'UserController/login');
Route::get('user/verify_email', 'UserController/verifyEmail');
Route::post('user/reminder_key', 'UserController/getReminderKey');
Route::post('user/update_reminder_key', 'UserController/updateReminderKey');
Route::post('user/resend_code', 'UserController/resendVerificationCode');  // 添加重发验证码路由
// 用户信息路由
Route::get('user/info', 'UserController/info');
// 意见反馈相关路由
Route::post('user/feedback/submit', 'UserController/submitFeedback');
Route::get('user/feedbacks', 'UserController/myFeedbacks');
// 提醒发送记录路由
Route::get('user/reminder/send_history', 'UserController/reminderSendHistory');
// 用户密码相关路由
Route::post('user/change_password', 'UserController/changePassword');  // 修改密码
Route::post('user/send_reset_code', 'UserController/sendResetCode');  // 发送重置验证码
Route::post('user/reset_password', 'UserController/resetPassword');   // 重置密码
Route::get('user/to_reset_password', 'UserController/toResetPasswordPage');
Route::get('reset_password', 'UserController/resetPasswordPage');  // 重置密码页面

// 提醒事项相关路由
Route::post('reminder/add', 'ReminderController/addReminder');  // 添加提醒
Route::get('reminder/list', 'ReminderController/getReminderList');  // 获取提醒列表
Route::post('reminder/complete', 'ReminderController/markReminderCompleted');  // 标记完成
Route::post('reminder/disable', 'ReminderController/disableReminder');  // 禁用提醒
Route::post('reminder/note', 'ReminderController/addNote');  // 添加备注
Route::post('reminder/postpone', 'ReminderController/postponeReminder');  // 延后提醒
Route::post('reminder/delete', 'ReminderController/deleteReminder');  // 删除提醒
// 相对时间创建提醒路由
Route::post('reminder/add_by_offset', 'ReminderController/addReminderByOffset');
// 获取系统时间路由
Route::get('reminder/current_time', 'ReminderController/getCurrentTime');
// 智能创建提醒路由
Route::post('reminder/add_smart', 'ReminderController/addReminderSmart');
// 提醒详情路由
Route::get('reminder/detail/:id', 'ReminderController/detail');
// 修改提醒路由
Route::post('reminder/update', 'ReminderController/update');
// 提醒操作页面路由
Route::get('reminder/complete_page', 'ReminderController/completeReminderPage');  // 标记完成页面
Route::get('reminder/disable_page', 'ReminderController/disableReminderPage');    // 禁用提醒页面
Route::get('reminder/postpone_page', 'ReminderController/postponeReminderPage');  // 延后提醒页面
Route::get('reminder/note_page', 'ReminderController/noteReminderPage');          // 备注页面

// 搜索提醒路由
Route::get('reminder/search', 'ReminderController/search')
    ->append(['api_type' => 'reminder_search']);  // 用于API限流

// 系统配置相关路由
Route::get('system', 'SystemController/index');  // 页面路由（仅初始化时可用）
Route::post('system/save', 'SystemController/save');  // 保存系统配置
Route::post('system/lock', 'SystemController/lock');  // 锁定系统配置
Route::get('system/configs', 'SystemController/getConfigs');  // API：获取配置列表
Route::get('system/config', 'SystemController/getConfig');   // API：获取单个配置
Route::post('system/config', 'SystemController/updateConfig'); // API：更新配置
// 隐私协议路由
Route::get('privacy', 'IndexController/privacy');

// 系统任务路由
Route::get('task/send_reminders', 'TaskController/sendReminders');
Route::post('task/send_single_reminder', 'TaskController/sendSingleReminder');


// 文档相关路由
Route::get('docs/api', 'DocsController/api');
Route::get('docs/get_doc', 'DocsController/getDoc');
// 系统使用说明路由
Route::get('howtouse/show', 'HowToUseController/show');
Route::get('howtouse/view', 'HowToUseController/getDoc');

// 测试相关路由
Route::get('test/email', 'TestController/testEmail');
// 测试接口路由
Route::get('test/security_email', 'TestController/testSecurityEmail');
Route::get('test/project/create', 'TestController/testCreateProject');
Route::get('test/project/list', 'TestController/testProjectList');
Route::get('test/project/update', 'TestController/testUpdateProject');
Route::get('test/project/status', 'TestController/testUpdateProjectStatus');
Route::get('test/project/delete', 'TestController/testDeleteProject');
// 笔记测试路由
Route::get('test/note/list', 'TestController/testNoteList');
Route::get('test/note/create', 'TestController/testNoteCreate');
Route::get('test/note/update', 'TestController/testNoteUpdate');
Route::get('test/note/delete', 'TestController/testNoteDelete');
Route::get('test/note/summarize', 'TestController/testNoteSummarize');
// 拍照测试页面路由
Route::get('test/photo', 'TestController/photo');

// 项目相关路由
Route::get('project/list', 'ProjectController/index');
Route::post('project/create', 'ProjectController/create');
Route::post('project/update', 'ProjectController/update');
Route::post('project/status', 'ProjectController/updateStatus');
Route::post('project/delete', 'ProjectController/delete');
Route::get('project/detail/:id', 'ProjectController/detail');

// 笔记相关路由
Route::get('note/list', 'NoteController/index');
Route::post('note/create', 'NoteController/create');
Route::post('note/update', 'NoteController/update');
Route::post('note/delete', 'NoteController/delete');
// 笔记详情路由
Route::get('note/detail/:id', 'NoteController/detail');
// 新增草稿和自动保存路由
Route::get('note/draft/:id', 'NoteController/draft');  // 获取草稿
Route::post('note/auto_save', 'NoteController/autoSave'); // 自动保存

// 笔记高级功能路由
Route::post('note/summarize', 'NoteController/summarize');  // AI总结
Route::get('note/search', 'NoteController/search');        // 搜索笔记
Route::post('note/share', 'NoteController/share');         // 分享笔记
Route::get('note/share/:key', 'NoteController/viewShared');// 查看分享
Route::post('note/export', 'NoteController/export');       // 导出笔记

// 聊天相关路由
Route::get('chat/sessions', 'ChatController/sessions');
Route::post('chat/session/create', 'ChatController/createSession');
Route::get('chat/messages', 'ChatController/messages');
Route::post('chat/message/send', 'ChatController/sendMessage');
Route::post('chat/session/delete', 'ChatController/deleteSession');


// 文件管理路由
Route::get('file/upload_token', 'FileController/getQiniuUploadToken');
// 文件下载凭证路由
Route::get('file/download_token', 'FileController/getQiniuDownloadToken');
Route::post('file/batch_download_tokens', 'FileController/getQiniuBatchDownloadTokens');

// 在路由配置文件中添加
Route::post('chat/ai', 'ChatController/aiChat');
Route::get('chat/stream', 'ChatController/aiStream');
// AI JSON格式流式响应
Route::get('chat/ai_json_stream', 'ChatController/aiJsonStream');
// 学习会话请求路由
Route::post('chat/learning', 'ChatController/learningChat');

// AI角色相关路由
Route::group('ai/role', function () {
    // 获取AI角色列表
    Route::get('list', 'AiRoleController/index');
    // 获取AI角色详情
    Route::get('detail/:id', 'AiRoleController/detail');
    // 创建AI角色
    Route::post('create', 'AiRoleController/create');
    // 更新AI角色
    Route::post('update/:id', 'AiRoleController/update');
    // 删除AI角色
    Route::post('delete/:id', 'AiRoleController/delete');
});

// 笔记转教案路由
Route::post('chat/note_to_plan', 'ChatController/convertNoteToTeachingPlan');

// 教案相关路由
Route::group('teaching-plan', function () {
    // 教案基本操作
    Route::get('index', 'TeachingPlanController/index');
    Route::post('create', 'TeachingPlanController/create');
    Route::post('update', 'TeachingPlanController/update');
    Route::post('delete', 'TeachingPlanController/delete');
    Route::get('detail', 'TeachingPlanController/detail');
    
    // 教案元素操作
    Route::post('add-element', 'TeachingPlanController/addElement');
    Route::post('update-element', 'TeachingPlanController/updateElement');
    Route::post('delete-element', 'TeachingPlanController/deleteElement');
    Route::post('update-element-sort', 'TeachingPlanController/updateElementSort');
});

// 课程大纲相关路由
Route::group('course', function () {
    Route::get('index', 'CourseOutlineController/index');
    Route::post('create', 'CourseOutlineController/create');
    Route::post('update', 'CourseOutlineController/update');
    Route::post('status', 'CourseOutlineController/updateStatus');
    Route::post('delete', 'CourseOutlineController/delete');
    Route::get('detail', 'CourseOutlineController/detail');
    Route::post('update-plans', 'CourseOutlineController/updatePlans');
});

// 智能学习相关路由
Route::group('learning', function () {
    // 智能学习对话接口
    Route::post('chat', 'LearningController/chat');
    
    // 学习流式响应接口（注意：流式响应接口Token通过URL参数传递）
    Route::get('stream', 'LearningController/stream');
    
    // 学习会话管理接口
    Route::post('session/init', 'LearningController/initSession');
    
    // 学习进度查询接口
    Route::get('progress', 'LearningController/progress');
    
    // 学习历史查询接口
    Route::get('history', 'LearningController/history');
});










